home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 127 / PC Guia 127.iso / Software / Produtividade / OpenOffice.org 2.0.1 / openofficeorg4.cab / MIMEMultipart.py < prev    next >
Text File  |  2005-11-19  |  1KB  |  40 lines

  1. # Copyright (C) 2002-2004 Python Software Foundation
  2. # Author: barry@python.org (Barry Warsaw)
  3.  
  4. """Base class for MIME multipart/* type messages.
  5. """
  6.  
  7. from email import MIMEBase
  8.  
  9.  
  10.  
  11. class MIMEMultipart(MIMEBase.MIMEBase):
  12.     """Base class for MIME multipart/* type messages."""
  13.  
  14.     def __init__(self, _subtype='mixed', boundary=None, _subparts=None,
  15.                  **_params):
  16.         """Creates a multipart/* type message.
  17.  
  18.         By default, creates a multipart/mixed message, with proper
  19.         Content-Type and MIME-Version headers.
  20.  
  21.         _subtype is the subtype of the multipart content type, defaulting to
  22.         `mixed'.
  23.  
  24.         boundary is the multipart boundary string.  By default it is
  25.         calculated as needed.
  26.  
  27.         _subparts is a sequence of initial subparts for the payload.  It
  28.         must be an iterable object, such as a list.  You can always
  29.         attach new subparts to the message by using the attach() method.
  30.  
  31.         Additional parameters for the Content-Type header are taken from the
  32.         keyword arguments (or passed into the _params argument).
  33.         """
  34.         MIMEBase.MIMEBase.__init__(self, 'multipart', _subtype, **_params)
  35.         if _subparts:
  36.             for p in _subparts:
  37.                 self.attach(p)
  38.         if boundary:
  39.             self.set_boundary(boundary)
  40.